package com.ahrhyj.web.controller.system;

import java.util.List;

import com.ahrhyj.system.domain.SysFastdfs;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ahrhyj.common.annotation.Log;
import com.ahrhyj.common.core.controller.BaseController;
import com.ahrhyj.common.core.domain.AjaxResult;
import com.ahrhyj.common.enums.BusinessType;
import com.ahrhyj.system.service.ISysFastdfsService;
import com.ahrhyj.common.core.page.TableDataInfo;

/**
 * 文件管理Controller
 * 
 * @author admin
 * @date 2020-09-25
 */
@RestController
@RequestMapping("/system/fastdfs")
public class SysFastdfsController extends BaseController
{
    @Autowired
    private ISysFastdfsService sysFileService;

    /**
     * 查询文件管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:fastdfs:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysFastdfs sysFastdfs)
    {
        startPage();
        List<SysFastdfs> list = sysFileService.selectSysFastdfsList(sysFastdfs);
        return getDataTable(list);
    }


    /**
     * 获取文件管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:fastdfs:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(sysFileService.selectSysFastdfsById(id));
    }

    /**
     * 删除文件管理
     */
    @PreAuthorize("@ss.hasPermi('system:fastdfs:remove')")
    @Log(title = "文件管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(sysFileService.deleteSysFastdfsByIds(ids));
    }
}
